import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import axios from 'axios'// 在assets/js/api.js中设置了
// import '@/assets/css/global.scss';//在vue.config.js中设置了
import '@/assets/js/api.js';

createApp(App).use(store).use(router).mount('#app')

//路由守卫
router.beforeEach((to, from, next) => {
    // console.log(to)
    // next()
   
    if (to.meta.requireLogin) {
      if (localStorage.getItem('Login')) {
        next()
      }
      else {
        alert('请登录')
        next('/login')
      }
    }
    else{
        next()
    }
});

// axios.defaults.baseURL = 'http://localhost:8081/api';  在assets/js/api.js中设置